import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FarmSaleInfoVO, FarmSaleInfoForm, FarmSaleInfoQuery } from '@/api/erp/farmSaleInfo/types';

/**
 * 查询销售明细列表
 * @param query
 * @returns {*}
 */

export const listFarmSaleInfo = (query?: FarmSaleInfoQuery): AxiosPromise<FarmSaleInfoVO[]> => {
  return request({
    url: '/erp/farmSaleInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询销售明细详细
 * @param id
 */
export const getFarmSaleInfo = (id: string | number): AxiosPromise<FarmSaleInfoVO> => {
  return request({
    url: '/erp/farmSaleInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增销售明细
 * @param data
 */
export const addFarmSaleInfo = (data: FarmSaleInfoForm) => {
  return request({
    url: '/erp/farmSaleInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改销售明细
 * @param data
 */
export const updateFarmSaleInfo = (data: FarmSaleInfoForm) => {
  return request({
    url: '/erp/farmSaleInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除销售明细
 * @param id
 */
export const delFarmSaleInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/erp/farmSaleInfo/' + id,
    method: 'delete'
  });
};
